package RandomTest;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class RandomTest {
    public static void main(String[] args) {
        //随机数字
        Random random=new Random();
        int nextInt=random.nextInt(1000);
        System.out.println(nextInt);
        //取指定范围内的随机值
        String[] target={"roy","will","土匪","aiming"};
        int indexNext=random.nextInt(target.length-1);
        System.out.println(target[indexNext]);

        //生成时间戳
        //指定时间格式的模板
       //  SimpleDateFormat
      SimpleDateFormat sdf=new SimpleDateFormat("HH-mm-sss");
      Date date=new Date();
      String msg=sdf.format(date);
        System.out.println(msg);

    }
}
